package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Digest;
import com.xx.pmis.persistence.dao.DigestDAO;
import com.xx.pmis.services.DigestService;

public class DigestServiceImpl implements DigestService {
	DigestDAO digestDAO = null;

	public DigestServiceImpl(DigestDAO digestDAO) {
		super();
		this.digestDAO = digestDAO;
	}

	public void saveOrUpdateDigest(Digest digest) throws Exception {
		digestDAO.saveOrUpdate(digest);
	}

	public void saveDigest(Digest digest) throws Exception {
		digestDAO.save(digest);
	}

	public void deleteDigest(Digest digest) throws Exception {
		digestDAO.delete(digest);
	}

	public Digest getDigestByDigestID(String digestID) throws Exception {
		Digest digest = digestDAO.getDigestByDigestID(digestID);
		return digest;
	}

	public List<Digest> getAllDigest() throws Exception {
		List<Digest> digests = digestDAO.getAllDigest();
		return digests;
	}

	public List<Digest> getAllDigestByPage(int currentPage, int lineSize) throws Exception {
		List<Digest> digests = digestDAO.getAllDigestByPage(currentPage, lineSize);
		return digests;
	}

	public int getCountOfDigest() throws Exception {
		return digestDAO.getAllDigest().size();
	}


}
